﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Resto.CostControl.Core.Enums;
using Resto.CostControl.Core.Cache;
using Resto.CostControl.Common.Consts;

namespace Resto.CostControl.Core.Query.MaterialModule.ViewObject
{
    [Serializable]
    public class MaterialVO
    {
        #region 基本属性

        public string ID { get; set; }

        /// <summary>
        /// 编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 单位（公斤等）
        /// </summary>
        public string Unit { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public string Specification { get; set; }

        /// <summary>
        /// 当前价格
        /// </summary>
        public decimal CurrentPrice { get; set; }

        /// <summary>
        /// 安全库存数
        /// </summary>
        public decimal SafeStorage { get; set; }

        /// <summary>
        /// 实际库存
        /// </summary>
        public decimal ActualSorage { get; set; }

        /// <summary>
        /// 是原材料，还是半成品
        /// </summary>
        internal string TypeCode { get; set; }

        /// <summary>
        /// 是原材料，还是半成品
        /// </summary>
        public MaterialType Type
        {
            get
            {
                return (MaterialType)Enum.Parse(typeof(MaterialType), TypeCode);
            }
        }

        /// <summary>
        /// 品名大类Code
        /// </summary>
        internal string CategoryCode { get; set; }

        /// <summary>
        /// 品名大类Name
        /// </summary>
        public string CategoryName
        {
            get
            {
                return DictionaryVOArrayCache.GetDicNameByCode(DictionaryTypeConsts.String_MaterialCategory_Code, CategoryCode);
            }
        }

        #endregion
    }

}
